﻿<Window x:Class="DesktopAnnotator.Settings.SettingWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="設定"
        Width="350"
        Height="350"
        MinWidth="350"
        MinHeight="350">
    <Window.Resources>
        <Style x:Key="CaptionGroupBoxStyle" TargetType="{x:Type GroupBox}">
            <Setter Property="BorderBrush" Value="{x:Null}" />
            <Setter Property="Padding" Value="25,5,5,5" />
        </Style>
        <Style x:Key="ColorButtonStyle" TargetType="{x:Type Button}">
            <Setter Property="Width" Value="50" />
            <Setter Property="Height" Value="22" />
            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
            <Setter Property="VerticalContentAlignment" Value="Stretch" />
            <Setter Property="Padding" Value="3,1" />
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <!--  設定領域  -->
        <Grid Margin="5">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <GroupBox Margin="5"
                      HorizontalAlignment="Stretch"
                      Header="ペン設定">
                <StackPanel Margin="5">
                    <GroupBox Style="{StaticResource CaptionGroupBoxStyle}">
                        <GroupBox.Header>
                            <TextBlock Text="{Binding PenThickness, StringFormat=太さ：{0:D}}" />
                        </GroupBox.Header>
                        <Slider Value="{Binding PenThickness}" Minimum="1" />
                    </GroupBox>
                    <GroupBox Header="色" Style="{StaticResource CaptionGroupBoxStyle}">
                        <Button Command="{Binding SelectPenColorCommand}" Style="{StaticResource ColorButtonStyle}">
                            <Rectangle Stroke="Black">
                                <Rectangle.Fill>
                                    <SolidColorBrush Color="{Binding PenColor}" />
                                </Rectangle.Fill>
                            </Rectangle>
                        </Button>
                    </GroupBox>
                </StackPanel>
            </GroupBox>
            <GroupBox Grid.Column="1"
                      Margin="5"
                      HorizontalAlignment="Stretch"
                      Header="マーカー設定">
                <StackPanel Margin="5">
                    <GroupBox Style="{StaticResource CaptionGroupBoxStyle}">
                        <GroupBox.Header>
                            <TextBlock Text="{Binding MarkerThickness, StringFormat=太さ：{0:D}}" />
                        </GroupBox.Header>
                        <Slider Value="{Binding MarkerThickness}" Maximum="30" Minimum="10" SmallChange="1" LargeChange="2" />
                    </GroupBox>
                    <GroupBox Header="色" Style="{StaticResource CaptionGroupBoxStyle}">
                        <Button Command="{Binding SelectMarkerColorCommand}" Style="{StaticResource ColorButtonStyle}">
                            <Rectangle Stroke="Black">
                                <Rectangle.Fill>
                                    <SolidColorBrush Color="{Binding MarkerColor}" />
                                </Rectangle.Fill>
                            </Rectangle>
                        </Button>
                    </GroupBox>
                </StackPanel>
            </GroupBox>
            <GroupBox Grid.Row="1"
                      Margin="5"
                      HorizontalAlignment="Stretch"
                      Header="背景設定">
                <StackPanel Margin="5">
                    <GroupBox Header="色" Style="{StaticResource CaptionGroupBoxStyle}">
                        <Button Command="{Binding SelectBackgroundColorCommand}" Style="{StaticResource ColorButtonStyle}">
                            <Rectangle Stroke="Black">
                                <Rectangle.Fill>
                                    <SolidColorBrush Color="{Binding BackgroundColor}" />
                                </Rectangle.Fill>
                            </Rectangle>
                        </Button>
                    </GroupBox>
                    <GroupBox Style="{StaticResource CaptionGroupBoxStyle}">
                        <GroupBox.Header>
                            <TextBlock Text="{Binding BackgroundTransparency, StringFormat=不透明度：{0:D}%}" />
                        </GroupBox.Header>
                        <Slider LargeChange="10"
                                Maximum="100"
                                Minimum="1"
                                SmallChange="1"
                                Value="{Binding BackgroundTransparency}" />
                    </GroupBox>
                </StackPanel>
            </GroupBox>
        </Grid>

        <!--  ボタン領域  -->
        <StackPanel Grid.Row="1"
                    Margin="5"
                    HorizontalAlignment="Right"
                    Orientation="Horizontal">
            <Button x:Name="btnOK"
                    Width="75"
                    Height="20"
                    Margin="5,0,0,0"
                    Click="btnOK_Click"
                    Command="{Binding SaveSettingsCommand}"
                    Content="OK" />
            <Button x:Name="btnCancel"
                    Width="75"
                    Height="20"
                    Margin="5,0,0,0"
                    Click="btnCancel_Click"
                    Command="{Binding CancelSettingsCommand}"
                    Content="キャンセル" />
        </StackPanel>


    </Grid>
</Window>
